# hello
#!/bin/bash
date=`date +"%Y-%m-%d-%H-%M-%S"`
document_root=/home/quangtm/editor.banbedev.net/server/Job
# Log file
log_file=$document_root/logs/sync-cache-$date.log
# source content
src=/home/quangtm/quangtm.thethao.vnexpressdev.net/public/
# array destination to sync file
arrDest[0]=/home/quangtm/photo.banbedev.net/public/sync_thethao/
arrDest[1]=/home/quangtm/banbedev.net/public/sync_thethao/
# Number destination
numDest=${#arrDest[*]}
# Loop to rsync
echo 'Start sync cache...'

for dest in ${arrDest[*]}
do
    echo "BEGIN: sync cache from " $src " to " $dest >> $log_file
    # rsync to each destination
    rsync -avuzr  --include="*.html" --exclude="css" --exclude="js" --exclude="images" --exclude=".svn" --exclude="*.php"  $src $dest >> $log_file
    echo "END: sync cache form " $src " to " $dest "\n\n" >> $log_file
done

echo 'Done'

exit 0
